Add capacity forecast client method#571
Merged
Merged
Conversation
klauspost
reviewed
Apr 13, 2026
1a5d6e9 to
805b4f5
Compare
a47844e to
fc0c35f
Compare
bazko1
approved these changes
May 7, 2026
fc0c35f to
134a0b6
Compare
klauspost
reviewed
May 10, 2026
Contributor
klauspost
left a comment
There was a problem hiding this comment.
Let's see if we can qualify the numbers a bit more.
a1ed3c1 to
8808b14
Compare
There was a problem hiding this comment.
Pull request overview
Adds a new Admin API client surface for retrieving storage capacity projection data from MinIO, exposing both current usage and forecasted “days until” threshold crossings.
Changes:
- Introduces a new
CapacityForecaststruct to model the/capacity-forecastresponse (including pointer “days until” fields). - Adds
AdminClient.CapacityForecast(ctx)to callGET /minio/admin/<v3|v4>/capacity-forecastand decode the JSON response.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
klauspost
reviewed
May 13, 2026
Add struct and client method for the new GET /admin/v4/capacity-forecast endpoint. Returns storage capacity predictions based on historical daily snapshots.
Add MinDaysUntilFull, RSquared, Variance, RecentGrowthRatePerDay, and RecentDaysUntilFull to CapacityForecast struct for Phase 2 of the prediction algorithm.
Expose concrete min/max daily usedFraction deltas so consumers can show the actual extremes alongside the statistical summary.
A -1 sentinel collides with legitimate negative values — e.g. days until 80%% full can legitimately be -5 when usage already crossed the threshold 5 days ago. Use *float64 with nil for "unknown" so the type system represents unset state cleanly. Addresses review feedback from klauspost.
Update struct and field comments to reflect the switch from OLS linear regression to a Kalman filter. No code or type changes.
The Kalman filter is the forecaster; an OLS R-squared offered no information about the filter's own predictions and only measured the linearity of the raw data. Drop the field to keep the API focused on what the filter actually computes.
Per review feedback, embed the unit in the names so readers do not have to look at the implementation to discover what they hold: - GrowthRatePerDay -> GrowthBytesPerDay - DataPointCount -> DailySnapshotCount The doc comments now also clarify that GrowthBytesPerDay is independent of DailySnapshotCount.
Per review feedback, document the nature of the trend used for the DaysUntil80/90/100Pct fields: the Kalman filter integrates up to 365 daily samples with recency-weighted emphasis, so a fresh shift in usage dominates over older history.
The previous fields expressed the change as a fraction in [-1, +1], which the reviewer found unclear. Bytes match the other size fields (CurrentUsedBytes, CurrentTotalBytes, GrowthBytesPerDay) and tell the user directly how much data was added or freed that day.
e455168 to
b957d44
Compare
Cover the request path/method, JSON decoding of *float64 days-until fields (nil, positive, negative), and the non-200 error path. Addresses Copilot's review feedback on PR minio#571.
harshavardhana
approved these changes
May 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the CapacityForecast struct and the AdminClient.CapacityForecast method that calls GET /admin/v4/capacity-forecast and returns the projection. Days-until threshold fields are pointer floats where nil means no prediction is possible and a negative value means the threshold was already crossed in the past, so magnitude is meaningful. Follows the existing ServerInfo client pattern.